using System.Collections.Generic;

using BLToolkit.Data;
using BLToolkit.DataAccess;

using EMan.Common.EnterpriseStructure;
using EMan.Server.Interface.DAL;

namespace EMan.DAL.Firebird
{
  public abstract class DepartmentDalc : Dalc< Department >, IDalc< Department >
  {
    [SqlQuery( "select * from department")]
    public abstract IList< Department > GetList();

    [ScalarSource(ScalarSourceType.AffectedRows)]
    [SqlQuery( @"insert into department( title, description) values ( @Title, @Description) returning id, revision")]
    public abstract bool Insert( [Direction.Output("Id", "Revision")] Department entity );

    [ScalarSource(ScalarSourceType.AffectedRows)]
    [SqlQuery(@"update department set title = @Title, description = @Description 
                  where (id = @Id) and (revision = @Revision) returning id, revision")]
    public abstract bool Update( [Direction.InputOutput( "Id", "Revision" )] Department entity );

    [SqlQuery( "select * from department where (id = @id)")]
    public abstract Department Get( int id );

    [ScalarSource(ScalarSourceType.AffectedRows)]
    [SqlQuery( "delete from department where (id = @id)" )]
    public abstract bool Delete( int id );
  }
}